(function(){
        var myChart=echarts.init(document.getElementById('left1'));
        var option = {
    title: {text: '营收趋势',
            textStyle: {color:"#21e6c1",fontSize: 18,fontFamily:"楷体"},
            left:'12%',
            top:'5%'
            },
    grid: {left:'5%',
           right:'5%',
           top:'20%',
           bottom:'5%',
           containLabel:true
          },
    tooltip: {
        trigger: 'axis',
        axisPointer: {            // 坐标轴指示器，坐标轴触发有效
            type: 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    xAxis: {
            type: 'category',
            data: [],
            axisLabel:{fontSize: 8,color:"white"},
            axisTick: {alignWithLabel: true},
            splitLine:{show: false}
          },
    yAxis: {
            type: 'value',
            axisLabel:{fontSize: 8,color:"white"},
            splitLine:{show: false}
       },
    series: [
        {
            name: '收入',
            type: 'bar',
            barWidth: '50%',
            data: [],
            itemStyle: {normal: {label: {show: true,position: 'top',textStyle: {color: "white",fontSize: 8}},
                                 color:"#43dde6"}
                        }}
    ]
};

function get_json_bar() {
    $.ajax({
        url: 'http://localhost:5000/left1',
        type: 'GET',
        success: function (e) {
        option.xAxis.data = e.map(subArray => subArray[0]);
        option.series[0].data = e.map(subArray => subArray[1]);
        myChart.setOption(option);
        setTimeout(get_json_bar,10000)
                               }
            });
}
//执行函数
get_json_bar();

      myChart.setOption(option);
})();